using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PACKETPARSERMAX20.CORE
{
	public class pool_gameobject : MangosBase
	{
		public System.UInt32? guid;
		public System.UInt32? pool_entry;
		public System.Single? chance;
		public System.String description;




		public override string GetInsertCommand()
		{
			return string.Format("INSERT IGNORE INTO `pool_gameobject` (`guid`, `pool_entry`, `chance`, `description`) VALUES ('{0}', '{1}', '{2}', '{3}');", guid.GetValueOrDefault(), pool_entry.GetValueOrDefault(), chance.GetValueOrDefault(), description.MySQLDBString());
		}


		public override string GetUpdateCommand()
		{
            StringBuilder sb = new StringBuilder();
						sb.Append("UPDATE `pool_gameobject` SET ");
			if(pool_entry != null)
			{
				sb.AppendLine("`pool_entry`='" + pool_entry.Value.ToString() + "'");
			}
			if(chance != null)
			{
				sb.AppendLine("`chance`='" + chance.Value.ToString() + "'");
			}
			if(description != null)
			{
				sb.AppendLine("`description`='" + description.MySQLDBString() + "'");
			}
				sb = sb.Replace("\r\n", ", ");
				sb.Append(" WHERE `guid`='" + guid.Value.ToString() + "';");
				sb = sb.Replace(",  WHERE", " WHERE");

            return sb.ToString();
		}


	}
}
